export default function define(Python: Blockly.BlockGenerators) {
  Python['import_sprites'] = function(block) {
    // TODO: Assemble Python into code variable.
    var code = 'from sprites import *\n';
    return code;
  }; 

  Python['sprites'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    let text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
    // TODO: Assemble Python into code variable.
    var code = variable_sprites+ ' = Sprite(' + text + ')\n';
    return code;
  };
  
  Python['addx'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    let text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
    // TODO: Assemble Python into code variable.
    var code = variable_sprites+ '.addx(' + text +')\n';
    return code;
  };
  
    Python['addy'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    let text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
    // TODO: Assemble Python into code variable.
    var code = variable_sprites+ '.addy(' + text +')\n';
    return code;
  };
  
Python['fd_bk'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    var dropdown_options = block.getFieldValue('options');
    let text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
    // TODO: Assemble Python into code variable.
    var code = variable_sprites+ '.' +dropdown_options+ '(' +text+ ')\n';
    return code;
  };
  
  Python['rt_lt'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    var dropdown_options = block.getFieldValue('options');
    let text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
    // TODO: Assemble Python into code variable.
    var code = variable_sprites+ '.' +dropdown_options+ '(' +text+ ')\n';
    return code;
  };
  
  Python['slide'] = function(block) {
    var variable_name = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    var value_text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
    var value_text1 = Blockly.Python.valueToCode(block, 'text1', Blockly.Python.ORDER_ATOMIC);
    // TODO: Assemble Python into code variable.
    var code = variable_name+ '.Slide([' +value_text1+ '],' + value_text +')\n';
    return code;
  };
  
  Python['sprites_random'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    // TODO: Assemble Python into code variable.
    var code = variable_sprites+ '.goto_random()\n';
    return code;
  };

  Python['bounce'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    // TODO: Assemble Python into code variable.
    var code = variable_sprites+ '.bounce_on_edge()\n';
    return code;
  };
  
  
  Python['rotatemode'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    let text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
    // TODO: Assemble Python into code variable.
    var code = variable_sprites+ '.rotatemode(' + text +')\n';
    return code;
  };
  
  Python['scale'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    let text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
    // TODO: Assemble Python into code variable.
    var code = variable_sprites+ '.scale(' + text +')\n';
    return code;
  };
  
    Python['hide'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    let text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
    // TODO: Assemble Python into code variable.
    var code = variable_sprites+ '.hide(' + text +')\n';
    return code;
  };
  
  Python['show'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    let text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
    // TODO: Assemble Python into code variable.
    var code = variable_sprites+ '.show(' + text +')\n';
    return code;
  };
  
  Python['mouse_pos'] = function(block) {
    var variable_string = Blockly.Python.variableDB_.getName(block.getFieldValue('string'), Blockly.Variables.NAME_TYPE);
    // TODO: Assemble Python into code variable.
    var code = variable_string+ ' = str(mouse_pos())\n';
    return code;
  };

  Python['draw_grid2'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    let text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
    let text1 = Blockly.Python.valueToCode(block, 'text1', Blockly.Python.ORDER_ATOMIC);
    let text2 = Blockly.Python.valueToCode(block, 'text2', Blockly.Python.ORDER_ATOMIC);
    let text3 = Blockly.Python.valueToCode(block, 'text3', Blockly.Python.ORDER_ATOMIC);
    // TODO: Assemble Python into code variable.
    var code = variable_sprites+ '.draw_grid2(' + text + ', ' + text1 + ', ' + text2 + ', ' + text3 +')\n';
    return code;
  };
  
  Python['shape'] = function(block) {
    var variable_sprites = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    let text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
    // TODO: Assemble Python into code variable.
    var code = 'sprites_temp = [str(i) + ".png" for i in range(' + text + ')]\n'
    var code1 = variable_sprites+ '= Sprites(shape = sprites_temp)\n';
    return code + code1;
  };
  
  Python['nextshape'] = function(block) {
    var variable_string = Blockly.Python.variableDB_.getName(block.getFieldValue('sprites'), Blockly.Variables.NAME_TYPE);
    // TODO: Assemble Python into code variable.
    var code = variable_string+ '.nextshape()\n';
    return code;
  };

}
